export default function thunk({ dispatch, getState }: { dispatch: IAction, getState: Function }) {
    return (next: Function) => (action: Function) => {
        //  异步处理，如果传了个function，就回调这个方法，传参为原始dispatch和getstate，dispatch优先
        if(typeof action === 'function') {
            return action(dispatch, getState)
        }

        return next(action)
    }
}
